home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Bombardier_PC / BSCRIPTS.CST / 00003_Script_planes menu < prev    next >
Text File  |  1999-04-25  |  4KB  |  131 lines

  1. -- ⌐ 1998 @radical.media, inc. & Concurrent New Media Group, L.L.C.
  2. -- Developed for Bombardier, Inc.
  3. --
  4. -- All programming developed by: 
  5. -- Robert Fabricant, Valerie Valoueva, Ossi Shaked, 
  6. -- Henry Sauvageot, Chris Howell & Chris Girand
  7. --
  8. -- Use of this code by parties other than @radical.media, inc. or their
  9. --agents 
  10. -- without the express written consent of @radical.media, inc. AND Concurrent 
  11. -- New Media Group, L.L.C. is strictly prohibited.
  12. ------------------------------------------------------
  13.  
  14.  
  15. --This behavior changes the planes menu item image on rollover and mouseUp and passes the mouseUp event to the castMember script.Each item has 4 states:
  16. --
  17. --1) neutral: when it's not selected and not rolled over
  18. --2)rolledOver: when it's not selected and rolled over
  19. --3)hilited: when it's selected and rolled over
  20. --4)selected: when it's selected and not rolled over
  21. --
  22. --Corresponding castMembers are always located in this particular order in the internal cast.It makes it possible to switch between them depending on the item's state by manipulating their castNum. So,in order to change the item's image when you go from, say, neutral to rolledOver state, all you have to do is to increase the item's sprite castNum by 1.
  23. -------------------------------------------------------
  24. property rolledOver,selected
  25. global gPlane, gPImage
  26.  
  27. on getbehaviorDescription
  28.   return "changes the image on rollover"
  29. end
  30.  
  31. on new me
  32.   --find out which menu Item is selected in the planes menu and save its sprite Number and its castMember Number in global variables gPlane and gPImage
  33.   
  34.   set mySprite = the spriteNum of me
  35.   puppetSprite mySprite, false
  36.   set aName = the name of member the member of sprite mySprite
  37.   if aName contains "hil" then
  38.     set gPlane = mySprite
  39.     set gPImage = the castnum of sprite gPlane-2
  40.   end if
  41.   set rolledOver = FALSE
  42.   set selected = FALSE
  43.   
  44. end
  45.  
  46.  
  47.  
  48.  
  49. on mouseEnter me
  50.   
  51.   if not rolledOver then
  52.     
  53.     if gPlane <> the spritenum of me then
  54.       set the castnum of sprite the spritenum of me to the castnum of sprite the spritenum of me + 1
  55.       
  56.     else 
  57.       if the castnum of sprite the spritenum of me <> gPImage+2 then
  58.         set the castnum of sprite the spritenum of me to  the castnum of sprite the spritenum of me -1
  59.       end if
  60.     end if
  61.     
  62.     set the ink of sprite the spritenum of me to 0
  63.     
  64.     if gPlane <> (the spritenum of me) and gPlane <> "" then
  65.       set the castnum of sprite gPlane to gPImage+3
  66.       set the ink of sprite gPlane to 39
  67.     end if
  68.     
  69.     
  70.     updatestage 
  71.     puppetsound 3, "mouse3"
  72.     set rolledOver = TRUE
  73.   end if
  74.   
  75. end
  76.  
  77.  
  78.  
  79. on mouseleave me
  80.   
  81.   if rolledOver then
  82.     if gPlane <> the spritenum of me then
  83.       set the castnum of sprite the spritenum of me to  the castnum of sprite the spritenum of me -1
  84.       set the ink of sprite the spritenum of me to 39
  85.       resetSelectedItem me
  86.       updatestage
  87.     end if
  88.     set rolledOver = FALSE
  89.   end if
  90.   
  91. end
  92.  
  93. on resetSelectedItem me
  94.   --  check if mouse is not over the planes menu and reselect the current plane in the planes menu if this is the case
  95.   
  96.   set lastMenuItemSprNum = getSpriteNumFromMemberName ("anchor")+1
  97.   set maxLocV = the bottom of sprite lastMenuItemSprNum
  98.   if gPlane <> the spritenum of me and gPlane <> "" and ¼
  99.      (the mouseh<=598 or the mouseh >= 762 or the mousev <=84 ¼
  100.      or the mousev >= maxLocV) then
  101.     set the castnum of sprite gPlane to gPImage+2
  102.     set the ink of sprite gPlane to 0
  103.     puppetsound 3, "mouse3"
  104.   end if
  105. end
  106.  
  107. --on mouseup me
  108. --  global comeFromQTVR
  109. --  
  110. --  if rolledOver and not selected then
  111. --    set selected = TRUE
  112. --    set comeFromQTVR = FALSE
  113. --    deselect menuController --this closes all bottom submenues if they were open
  114. --    if gPlane <> the spritenum of me then
  115. --      set gPlane = the spritenum of me
  116. --      set gPImage = the castnum of sprite the spritenum of me -1
  117. --    end if
  118. --    set the castnum of sprite the spritenum of me to  the castnum of sprite the spritenum of me +1
  119. --    set the ink of sprite the spritenum of me to 0
  120. --    
  121. --    sound stop(1)
  122. --    sound stop(2)
  123. --    --  sendAllSprites(#CDSmallMenuPuppetsOff)
  124. --    --  sendAllSprites(#CDMenuPuppetsOff)
  125. --    --  sendAllSprites(#layoutPuppetsOff)
  126. --    pass
  127. --  end if
  128. --  
  129. --end
  130. --
  131.